public class lk733 {
    public static void main(String[] args) {
        int a[][]=new int[3][3];
    }   
    public int[][] floodFill(int[][] image, int sr, int sc, int color) {
            int q=image[sr][sc];
            fuck(image, sr, sc, color, q);
    }
    public static void fuck(int[][] image,int x,int y,int color,int q){
        int m=image.length;
        int n=image[0].length;
        if(image[x][y]==q){
            image[x][y]=color;
        }
        if(x>=1){
            fuck(image, x-1, y, color, q);
        }
        if(x<n-1){
            fuck(image, x+1, y, color, q);
        }
        if(y>=1){
            fuck(image, x, y-1, color, q);
        }
        if(y<=m-1){
            fuck(image, x, y+1, color, q);
        }
        
    }
}
